package com.tencent.iov.cowin.befsale.clue.repository.clue.impl;

import com.github.pagehelper.Page;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.request.ClueExpireRequest;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.request.QueryClueCustomerCollectAllRequest;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueDistributeResponse;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueExpirePesponse;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.ClueFollowHeadTypeResponse;
import com.tencent.iov.cowin.befsale.clue.controller.clue.vo.response.CountDateResponse;
import com.tencent.iov.cowin.befsale.clue.controller.cus.vo.request.ClueIntentionGradeDataRequest;
import com.tencent.iov.cowin.befsale.clue.dao.clue.ClueCustomerCollectDao;
import com.tencent.iov.cowin.befsale.clue.domain.clue.po.ClueCustomerCollect;
import com.tencent.iov.cowin.befsale.clue.repository.clue.ClueCustomerCollectManager;
import com.tencent.iov.cowin.befsale.clue.value.contants.ServiceConstant;
import com.software.boot.dao.annotation.TargetDataSource;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @Describe: 线索客户宽表_Manager实现层
 * @author: whp
 * @created: 2021-12-23 14:53:40
 * @version: 1.0
 */
@Service
public class ClueCustomerCollectManagerImpl implements ClueCustomerCollectManager {
	
	@Autowired
	private ClueCustomerCollectDao clueCustomerCollectDao;




	/**
	 * 通过ID获取详细信息
	 *
	 * @param: id
	 * @return: ClueCustomerCollect对象
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public ClueCustomerCollect getDetailById(Long id){
		return clueCustomerCollectDao.getDetailById(id);
	}

	/**
	 * 单条数据插入ClueCustomerCollect
	 * @param request
	 * @return 插入的条数
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_WRITE)
	public int insert(ClueCustomerCollect request){
		return clueCustomerCollectDao.insert(request);
    }

	/**
	 * 批量插入ClueCustomerCollect
	 * @param requests
	 * @return 批量插入的条数
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int insertBatch(List<ClueCustomerCollect> requests){
		return clueCustomerCollectDao.insertBatch(requests);
    }

	/**
	 * 单条ClueCustomerCollect更新
	 * @param request
	 * @return 更新的条数
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_WRITE)
    public int update(ClueCustomerCollect request){
		return clueCustomerCollectDao.update(request);
    }

	/**
	 * 单条ClueCustomerCollect更新
	 * @param request 参数
	 * @return 更新的条数
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_WRITE)
	public int updateByIdAndUpdateTime(ClueCustomerCollect request){
		return clueCustomerCollectDao.updateByIdAndUpdateTime(request);
	}

	/**
	 * 单条ClueCustomerCollect删除
	 * @param id
	 * @return 删除的条数
	 */
	@Override
	public int delete(Integer id) {
		return clueCustomerCollectDao.delete(id);
	}

	/**
	 * 根据条件查询对象list列表
	 * @param request
	 * @return 查询结果
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public List<ClueCustomerCollect> getListByParam(ClueCustomerCollect request){
		return clueCustomerCollectDao.getListByParam(request);
	}

	/**
	 * 根据条件查询对象page记录
	 * @param request
	 * @param rowBounds
	 * @return 分页对象
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public Page<ClueCustomerCollect> getPageByParam(ClueCustomerCollect request, RowBounds rowBounds){
		return clueCustomerCollectDao.getPageByParam(request, rowBounds);
	}

	/**
	 * 单条数据查询统计 ClueCustomerCollect
	 * @param request
	 * @return 插入的条数
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public int getClueCustomerCollect(QueryClueCustomerCollectAllRequest request) {
		return clueCustomerCollectDao.getClueCustomerCollect(request);
	}

	/**
	 * 单条数据查询统计 ClueCustomerCollect
	 * @param request
	 * @return 插入的条数
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public List<CountDateResponse> getClueCustomerCollectDate(QueryClueCustomerCollectAllRequest request) {
		return clueCustomerCollectDao.getClueCustomerCollectDate(request);
	}

	/**
	 * 跟进头部查询
	 * @param request
	 * @return
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public 	List<ClueFollowHeadTypeResponse>  getClueFollowHeadTypeResponse(ClueCustomerCollect request) {
		return clueCustomerCollectDao.getClueFollowHeadTypeResponse(request);
	}
	/**
	 * 线索状态跟进头部查询
	 * @param request
	 * @return
	 */
	@Override
	public List<ClueFollowHeadTypeResponse> getClueStatusHeadTypeResponse(QueryClueCustomerCollectAllRequest request) {
		return clueCustomerCollectDao.getClueStatusHeadTypeResponse(request);
	}

	/**
	 * 跟进列表查询
	 * @param request
	 * @param rowBounds
	 * @return
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public Page<ClueCustomerCollect> getPageByParamAll(QueryClueCustomerCollectAllRequest request, RowBounds rowBounds) {
		return clueCustomerCollectDao.getPageByParamAll(request, rowBounds);
	}

	/**
	 * ids 修改
	 * @param request
	 * @return
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_WRITE)
	public int updateByIds(ClueCustomerCollect request) {
		return clueCustomerCollectDao.updateByIds(request);
	}

	/**
	 * 头部部战败审批统计
	 * @param request
	 * @return 头部部战败审批统计
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public List<ClueFollowHeadTypeResponse> getClueFailFollowHeadTypeResponse(QueryClueCustomerCollectAllRequest request) {
		return clueCustomerCollectDao.getClueFailFollowHeadTypeResponse(request);
	}

	/**
	 *头部部线索分配统计
	 *
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public ClueDistributeResponse getClueDistributeResponse(QueryClueCustomerCollectAllRequest request) {
		return clueCustomerCollectDao.getClueDistributeResponse(request);
	}

	@Override
	public ClueCustomerCollect getOneByParam(ClueCustomerCollect collectRequest) {
		return clueCustomerCollectDao.getOneByParam(collectRequest);
	}

	@Override
	public int updateByClueId(ClueCustomerCollect request) {
		return clueCustomerCollectDao.updateByClueId(request);
	}

	/**
	 * 总部逾期已跟进
	 * @param clueExpireRequest
	 * @return
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public Page<ClueExpirePesponse> getOemClueExpireList(ClueExpireRequest clueExpireRequest, RowBounds rowBounds) {
		return clueCustomerCollectDao.getOemClueExpireList(clueExpireRequest,rowBounds);
	}
	/**
	 * 经销商逾期已跟进
	 * @param clueExpireRequest
	 * @return
	 */
	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public Page<ClueExpirePesponse> getDealerClueExpireList(ClueExpireRequest clueExpireRequest, RowBounds rowBounds){
		return clueCustomerCollectDao.getDealerClueExpireList(clueExpireRequest,rowBounds);
	}

	@Override
	@TargetDataSource(ServiceConstant.QW_SALE_READ)
	public int updateByCusIdsAndDealerId(ClueCustomerCollect request) {
		return clueCustomerCollectDao.updateByCusIdsAndDealerId(request);
	}

	/**
	 * 根据条件查看显示未分配的数量
	 * add by zly
	 * @param clueIntentionGradeDataRequest
	 * @return
	 */
	@Override
	public Integer getDistributeCount(ClueIntentionGradeDataRequest clueIntentionGradeDataRequest) {
		return clueCustomerCollectDao.getDistributeCount(clueIntentionGradeDataRequest);
	}
}
